#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    int i = 0;
    int j = 0;
    int k = 0;
    __pid_t pid1 = fork();
    if (pid1 > 0)
    {
        __pid_t pid2 = fork();
        if (pid2 > 0)
        {
            while (1)
            {
                printf(" 2: %d\n", j++);
                sleep(1);
            }
        }
        if (pid2 == 0)
        {
            while (1)
            {
                printf(" 3: %d\n", k++);
                sleep(1);
            }
        }
    }

    if (pid1 == 0)
    {
        while (1)
        {
            printf(" 1: %d\n", i++);
            sleep(1);
        }
    }
}